<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="layout">
<head>
    <title>New/Edit Owner</title>
    <link rel="stylesheet" href="../../static/css/bootstrap.min.css"/>
</head>
<body>

<div class="container">

    <!-- sample header -->
    <nav class="navbar navbar-default navbar-inverse" role="navigation">
        <div class="navbar-header">
            <a class="navbar-brand" href="#">Static Brand</a>
        </div>

        <div class="collapse navbar-collapse">
            <ul class="nav navbar-nav">
                <li class="active"><a href="employeeList.html">Link1</a></li>
                <li><a href="#">Link2</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#">Link3</a></li>
            </ul>
        </div>
    </nav>
    <!-- sample header end -->

    <h1 layout:fragment="header">
        <span th:text="${owner['new']} ? 'New Owner' : 'Edit Owner'" th:remove="tag">New/Edit Owner</span>
    </h1>

    <div layout:fragment="content">
        <div class="row">
            <div class="col-sm-6">
                <form th:object="${owner}" th:method="${owner['new']} ? post : put" action="./ownerDetails.html"
                      th:action="'#'" class="form-horizontal">
                    <!--th:action="@{${#httpServletRequest.servletPath}}"-->
                    <!--            <div class="form-group has-feedback">-->
                    <div class="form-group" th:classappend="${#fields.hasErrors('firstName')} ? error">
                        <label class="col-sm-4 control-label">First Name</label>
                        <div class="col-sm-8">
                            <input class="form-control" th:field="*{firstName}"/>
                            <span class="help-inline" th:errors="*{firstName}">[error]</span>
                        </div>
                    </div>

                    <div class="form-group" th:classappend="${#fields.hasErrors('lastName')} ? error">
                        <label class="col-sm-4 control-label">Last Name</label>
                        <div class="col-sm-8">
                            <input class="form-control" th:field="*{lastName}"/>
                            <span class="help-inline" th:errors="*{lastName}">[error]</span>
                        </div>
                    </div>

                    <div class="form-group" th:classappend="${#fields.hasErrors('address')} ? error">
                        <label class="col-sm-4 control-label">Address</label>
                        <div class="col-sm-8">
                            <input class="form-control" th:field="*{address}"/>
                            <span class="help-inline" th:errors="*{address}">[error]</span>
                        </div>
                    </div>

                    <div class="form-group" th:classappend="${#fields.hasErrors('city')} ? error">
                        <label class="col-sm-4 control-label">City</label>
                        <div class="col-sm-8">
                            <input class="form-control" th:field="*{city}"/>
                            <span class="help-inline" th:errors="*{city}">[error]</span>
                        </div>
                    </div>

                    <div class="form-group" th:classappend="${#fields.hasErrors('telephone')} ? error">
                        <!-- th:class="'form-group' + ${status.error} ? 'has-error' : ''"-->
                        <label class="col-sm-4 control-label">Telephone</label>
                        <div class="col-sm-8">
                            <input class="form-control" th:field="*{telephone}"/>
                            <span class="help-inline" th:errors="*{telephone}">[error]</span>
                            <!--<span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>
                            <span th:if="${not status.error and not empty status.actualValue}">
                               <span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>
                                <span class="help-inline" th:text="${status.errorMessage}">some error</span>
                            </span>-->
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-offset-4 col-sm-8">
                            <button class="btn btn-default" type="submit"
                                    th:text="${owner['new']} ? 'Add Owner' : 'Update Owner'">
                                Add Owner
                            </button>
                        </div>
                    </div>

                </form>
            </div>
        </div>
        
        <!--    <form:form modelAttribute="owner" class="form-horizontal" id="add-owner-form">
                <div class="form-group has-feedback">
                    <petclinic:inputField label="First Name" name="firstName"/>
                    <petclinic:inputField label="Last Name" name="lastName"/>
                    <petclinic:inputField label="Address" name="address"/>
                    <petclinic:inputField label="City" name="city"/>
                    <petclinic:inputField label="Telephone" name="telephone"/>
                </div>
            </form:form>-->
    </div>

    <div class="text-center">
        sample copyright 2016
    </div>
</div>
</body>
</html>
